public class Main {
    public static void main(String[] args) {
        String str="abcdcbs";
        String str1="abcba";
        System.out.println(judge(str));
        System.out.println(judge(str1));
    }

    /**
     * 判断是否为回文字符串
     * @param str
     * @return
     */
    public static boolean judge(String str){
        char[] ch=str.toCharArray();
        char[] ch1=new char[str.length()];
        for(int i=0;i<str.length();i++){
            ch1[i]=str.charAt(str.length()-i-1);
        }
        for(int i=0;i<str.length();i++){
            if(ch[i]!=ch1[i]){
                return false;
            }
        }
        return true;
    }

}